package com.ly.common.util;

import com.ly.common.biz.BizException;

/**
 * 检查工具类
 */
public class CheckUtils {

    /**
     * 测试 res 的值, 如果为 true, 则抛出业务异常
     * @param res
     * @param errorMsg
     * @throws BizException
     */
    public static void check(boolean res, String errorMsg) throws BizException {
        if (res) {
            throw new BizException(errorMsg);
        }
    }

    public static void checkEmpty(Object value, String errorMsg) throws BizException {
        check(value == null || value.toString().trim().isEmpty(), errorMsg);
    }

}
